Click Reports > Delivery Settings > Flex Web Service.
Activate the Flex Web Service by clicking
the Click Here to Activate
link.
The page refreshes, indicating a status of ACTIVE for
the Flex Web Service, and lets you generate a confirmation number,
which you will need to initiate Flex requests and retrieve Flex reports.
Generate a new token:
In the Should Expire After list,
select the amount of time before the token expires. The token is valid
for a 6 hour period by default.
In the Valid For IP Address field,
enter an IP address to restrict the token to that IP address. If you
leave this field blank, there will be no IP address restrictions.
Click Generate
New Token.
The page refreshes, updating the Current Token Details section with
information about your newly-generated token. When you generate a
new token, you invalidate the current token.
Initiate an automated Flex Web Service
request:
Make sure you have the following
information:
Your current token (displayed in the Current Token Details section
of the page) The Flex Query ID generated when you created the Flex query.
Programmatic access requres the User-Agent HTTP header to be set. Accepted values are: Blackberry or Java
Type the following URL in your
browser’s Address field:
Where: TOKEN is your current token QUERY_ID
is the Flex Query ID v=2 specifies that you are using Flex Web Service Version 2. Note that if you omit this parameter, the system will use Version 2.
You will receive an XML response from IB containing
the following information:
Reference
Code - If the request was successful, the XML response
will contain a numeric reference code. This code will be used to retrieve
the generated Flex query. If the request was unsuccessful, you will receive an error message as the code.
Response URL
- This is the URL to be used to retrieve the Flex report.
Here is a sample successful XML response using Version 2:
Here is a sample unsuccessful XML response Version 2:
Retrieve the Flex data:
Be sure that you have your current
token number, and the reference code you received as part of the response
to your initial request.
Type the following URL in your
browser’s Address field:
Where: REFERENCE_CODE is the code you received as part of the response
when you placed the request TOKEN is your current token VERSION is the version of the Flex Web Service Version you are using. You can set this to 2 or 3. Note that if you do not specify a Version, the system will use Version 2.
You will receive the Flex data as the response if
the request was successful. Otherwise, you will receive a XML based response
informing you that the request was invalid. Here is an example of an unsuccessful request to retrieve the Flex data: